/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 12, 2009 9:29:41 PM $
 *
 * Author: Eric Yang
 * Date  : Aug 12, 2009 9:29:41 PM
 *
 */
package com.gooex.web.action.manage.category;

import java.util.List;
import org.c4j.string.StringTools;

import com.gooex.domain.base.Category;
import com.gooex.domain.base.Property;

/**
 * @author Eric Yang
 * @version 1.0
 */
public class ViewCategory extends BaseCategoryAction {

	private Category category;

	private List<Category> children;

	public String execute() throws Exception {
		if (category != null && !StringTools.isBlankOrNull(category.getId())) {
			category = categoryManager.getCategory(category.getId());
			if (category != null)
				children = categoryManager.getCategories(category);
		}
		return SUCCESS;
	}

	public List<Category> getChildren() {
		return children;
	}

	public List<Property> getProperties() {
		return propertyManager.getProperties();
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Category getCategory() {
		if (category == null)
			category = new Category();
		return category;
	}

}
